//
//  BaseTableView.swift
//
//  Created by ink on 2024/6/23.
//  Copyright © 2024 ZM. All rights reserved.
//

import UIKit

open class BaseCollectionView: UICollectionView {
    
    deinit {
        NotificationCenter.default.removeObserver(self)
    }
}




open class BaseTableView: UITableView {
    
//    public func render(itemModel: ItemsModelProtocol? = nil,withoutInvalidateHeightCache: Bool? = false) {
//        super.render(itemModel:itemModel)
//        withoutInvalidateHeightCache == true ? fd_reloadDataWithoutInvalidateIndexPathHeightCache() : reloadData()
//    }

    @objc public func updateAutolayoutCellHeight() {
        beginUpdates()
        endUpdates()
    }
    
    public func fixUpdateAutolayoutCellHeight(afterDelay:TimeInterval = 0.2) {
        Self.cancelPreviousPerformRequests(withTarget: self, selector: #selector(Self.updateAutolayoutCellHeight), object: nil)
        self.perform(#selector(Self.updateAutolayoutCellHeight), with: nil, afterDelay: afterDelay)
    }
    
    deinit {
        NotificationCenter.default.removeObserver(self)
    }
}
